package com.tanhua.sso.controller;

import com.tanhua.sso.service.UserInfoService;
import com.tanhua.sso.vo.ErrorResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("user")
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    @PostMapping("loginReginfo")
    public ResponseEntity<Object> saveUserInfo(@RequestHeader("Authorization") String token,@RequestBody Map<String,String> param){
        Boolean flag=userInfoService.saveUserInfo(token,param);
        if (flag){
            return ResponseEntity.ok(null);
        }
        ErrorResult errorResult = ErrorResult.builder().errCode("000002").errMessage("登录失败！").build();
        return  ResponseEntity.status(500).body(errorResult);
    }
}
